home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-MIPS / SMPLOCK.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  1KB  |  53 lines

  1. /* $Id$
  2.  *
  3.  * This file is subject to the terms and conditions of the GNU General Public
  4.  * License.  See the file "COPYING" in the main directory of this archive
  5.  * for more details.
  6.  *
  7.  * Default SMP lock implementation
  8.  */
  9. #include <linux/interrupt.h>
  10. #include <asm/spinlock.h>
  11.  
  12. extern spinlock_t kernel_flag;
  13.  
  14. /*
  15.  * Release global kernel lock and global interrupt lock
  16.  */
  17. #define release_kernel_lock(task, cpu) \
  18. do { \
  19.     if (task->lock_depth >= 0) \
  20.         spin_unlock(&kernel_flag); \
  21.     release_irqlock(cpu); \
  22.     __sti(); \
  23. } while (0)
  24.  
  25. /*
  26.  * Re-acquire the kernel lock
  27.  */
  28. #define reacquire_kernel_lock(task) \
  29. do { \
  30.     if (task->lock_depth >= 0) \
  31.         spin_lock(&kernel_flag); \
  32. } while (0)
  33.  
  34.  
  35. /*
  36.  * Getting the big kernel lock.
  37.  *
  38.  * This cannot happen asynchronously,
  39.  * so we only need to worry about other
  40.  * CPU's.
  41.  */
  42. extern __inline__ void lock_kernel(void)
  43. {
  44.     if (!++current->lock_depth)
  45.         spin_lock(&kernel_flag);
  46. }
  47.  
  48. extern __inline__ void unlock_kernel(void)
  49. {
  50.     if (--current->lock_depth < 0)
  51.         spin_unlock(&kernel_flag);
  52. }
  53.